package com.project.poetry.service.controller;

import com.project.poetry.service.entity.dto.statistics.StatisticsAuthorPoetryDTO;
import com.project.poetry.service.entity.dto.statistics.StatisticsResultDTO;
import com.project.poetry.service.service.StatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 统计控制器
 * @author mengxj
 */
@Api("统计")
@RestController
@RequestMapping("statistics")
public class StatisticsController {

    @Resource
    private StatisticsService statisticsService;

    @ApiOperation("统计不同朝代的作者，作品和作品类型的数量")
    @GetMapping("statisticsResult")
    public StatisticsResultDTO statisticsResult(){
        return this.statisticsService.statisticsResult();
    }

    @ApiOperation("统计作者对应的作品数量")
    @GetMapping("statisticsAuthorPoetry")
    public StatisticsAuthorPoetryDTO statisticsAuthorPoetry(){
        return this.statisticsService.statisticsAuthorPoetry();
    }
}
